package yatan.cluster.job.impl;

import yatan.cluster.job.JobRunner;
import yatan.cluster.job.JobRunnerFactory;

public class ClassNameJobRunnerFactory implements JobRunnerFactory {
    @Override
    public JobRunner createJobRunner(String name) {
        try {
            return (JobRunner) Class.forName(name).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            return null;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }
}
